feat(convert): add content-focused extraction with boilerplate stripping#78
Merged
feat(convert): add content-focused extraction with boilerplate stripping#78
Conversation
Add strip_boilerplate() that removes nav/footer/aside/header and
role-based boilerplate elements. When <main> or <article> is present,
extracts only that content. New content_focus field on FetchRequest
("main" strips boilerplate, "full" or omitted keeps everything).
Closes #72
e711f60 to
a14d6d9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add
strip_boilerplate()function andcontent_focusrequest field to reduce token waste from navigation, footers, and sidebars.Why
Most web pages are 80%+ boilerplate. Agents waste LLM context tokens on nav menus, footers, and sidebars that are irrelevant to the content they're trying to understand.
How
content_focusfield onFetchRequest:"main"strips boilerplate,"full"(default) keeps everythingstrip_boilerplate()strategy:<main>or<article>exists, extract only that contentrole="main"element exists, extract that<nav>,<footer>,<aside>,<header>and elements with rolesnavigation,banner,contentinfo,complementaryRisk
content_focus: "main", default behavior unchangedChecklist
Closes #72